package com.icez.android_framework

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding

/**
 * activity基类
 * @sample 
 * @author Icez
 */
abstract class BaseActivity<B: ViewDataBinding>: AppCompatActivity() {
    // binding 类
    var binding: B? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = DataBindingUtil.setContentView(this,getContentView())
        binding?.lifecycleOwner = this
        setContentView(binding?.root)
        initClick()
        getBundleParams()
        initViewValue()
    }

    /**
     * 获取内容布局
     * @sample
     * @author Icez
     */
    abstract fun getContentView():Int

    /**
     * 初始化点击事件
     * @sample
     * @author Icez
     */
    abstract fun initClick()

    /**
     * 获取传递过来的参数
     * @sample
     * @author Icez
     */
    abstract fun getBundleParams()

    /**
     * 初始化控件的值
     * @sample
     * @author Icez
     */
    abstract fun initViewValue()


}